import request from "./config";

// 登录
export const login = (data) => {
  return request({
    url: "/api/user/login",
    method: "post",
    data,
  });
};

// 注册
export const register = (data) => {
  return request({
    url: "/api/user/register",
    method: "post",
    data,
  });
};

// 获取用户详情
export const getUserProfile = (params) => {
  return request({
    url: `/api/user/detail`,
    method: "get",
    params,
  });
};

// 更新用户信息
export const updateUserProfile = (data) => {
  return request({
    url: `/api/user/update`,
    method: "post",
    data,
  });
};

// 修改密码
export const changePassword = (data) => {
  return request({
    url: `/users/changePassword`,
    method: "put",
    data,
  });
};

// 关注关注用户
export const followUser = (data) => {
  return request({
    url: `/api/follows/follow`,
    method: "post",
    data,
  });
};

// 取消关注用户
export const unfollowUser = (data) => {
  return request({
    url: `/api/follows/unfollow`,
    method: "delete",
    data,
  });
};

// 充值
export const recharge = (data) => {
  return request({
    url: "/api/user/recharge",
    method: "post",
    data,
  });
};

// 付费购买文章
export const purchaseArticle = (data) => {
  return request({
    url: "/users/purchase",
    method: "post",
    data,
  });
};

// 获取用户关注列表
export const getFollowingList = (params) => {
  return request({
    url: `/api/follows/list`,
    method: "get",
    params,
  });
};

// 获取点赞列表
export const getLikeList = (params) => {
  return request({
    url: `/api/user/userLikes`,
    method: "get",
    params,
  });
};
// 获取点赞列表
export const getPaymentList = (params) => {
  return request({
    url: `/api/user/userPayments`,
    method: "get",
    params,
  });
};
